package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.mapper.HealthMapper;
import com.xxx.modules.entity.Health;
import com.xxx.modules.service.HealthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * health
 *
 * @author 北易航
 * @since 1.0.0 2023-02-05
 */
@Service
public class HealthServiceImpl extends ServiceImpl<HealthMapper, Health> implements HealthService {

    @Autowired
    private HealthMapper healthMapper;


    @Override
    public PageInfo<Health> selectHealthInfo(Health health, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper<Health> wrapper = new QueryWrapper<>();
        List<Health> data = healthMapper.selectListInfo(health);
        return new PageInfo<>(data);
    }

    @Override
    public void saveHealthInfo(Health health) {
        healthMapper.insert(health);
    }

    @Override
    public void updateHealthInfo(Health health) {
        healthMapper.updateById(health);
    }

    @Override
    public void delHealthInfo(Integer id) {
        healthMapper.deleteById(id);
    }

    @Override
    public void delBatchHealthInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        healthMapper.deleteBatchIds(list);
    }


}